function setAccessToken(token) {
  uni.setStorageSync('__TOKEN__', token)
}

function getAccessToken() {
  let token = uni.getStorageSync('__TOKEN__')
  if (token instanceof Object) {
    return token.type + ' ' + token.token
  }
  return undefined
}

function clearTokens() {
  uni.removeStorageSync('__TOKEN__')
}

export {
  setAccessToken,
  getAccessToken,
  clearTokens
}
